package com.amit.jsf;

import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;

@ManagedBean(name="hello")
@SessionScoped
public class HelloBean {
	
	private String name;
	private String email;
	private String phone;
	private int age;
	
	@ManagedProperty(value="10-10-10")
	private String dob;
	
	@ManagedProperty(value="M.Sc")
	private String qualification;
	
	@ManagedProperty(value="#{testBean.courses}")
	private List<String> courses;
	
	
	@ManagedProperty(value="#{testBean.refs}")
	private Map<String, Long> refs;


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public String getEmail() {
		return email;
	}


	public void setEmail(String email) {
		this.email = email;
	}


	public String getPhone() {
		return phone;
	}


	public void setPhone(String phone) {
		this.phone = phone;
	}


	public int getAge() {
		return age;
	}


	public void setAge(int age) {
		this.age = age;
	}


	public String getDob() {
		return dob;
	}


	public void setDob(String dob) {
		this.dob = dob;
	}


	public String getQualification() {
		return qualification;
	}


	public void setQualification(String qualification) {
		this.qualification = qualification;
	}


	public List<String> getCourses() {
		return courses;
	}


	public void setCourses(List<String> courses) {
		this.courses = courses;
	}


	public Map<String, Long> getRefs() {
		return refs;
	}


	public void setRefs(Map<String, Long> refs) {
		this.refs = refs;
	}
	
	
	@PostConstruct
	public void myInit()
	{
		System.out.println("myInit()");
	}
	
	
	@PreDestroy
	public void myDestroy()
	{
		System.out.println("myDestroy");
	}
	
	public String  show()
	{
		this.phone=HelloService.getPhone();
		this.age=HelloService.getAge();
		return "show";
	}
	
	
	
	
	
	
	
	
	
	
	

}
